#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
int mark[26];

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

ll qmi(ll a, ll b)
{
    ll res = 1;
    while(b)
    {
        res = res * a % mod;
        b >>= 1;
        a = a * a % mod;
    }
    return res;
}

void solve()
{
    memset(mark, 0, sizeof(mark));
    int n, k, m;
    cin >> n >> k >> m;
    string s;
    cin >> s;
    unordered_map<char, bool>mp;
    string res;
    for(int i = 0; i < k; i++) mp[i + 'a'] = true;
    int ans = 1, left = k;
    for(auto ch : s)
    {
        //cout << mark[ch - 'a'] << ' ' << mp[ch] << endl;
        if(mark[ch - 'a'] < ans && mp[ch])
        {
            mark[ch - 'a'] = ans;
            //cout << left << endl;
            if(--left == 0)
            {
                res += ch;
                left = k;
                ans++;
            }
        }
    }
    if(ans <= n)
    {
        //cout << ans << ' ' << res << endl;
        cout << "NO" << endl;
        while(res.size() < n){
            for(int i = 0; i < 26; i++)
            {
                if(mp[i + 'a'] && mark[i] < ans){
                    res += (i + 'a');
                    break;
               }
            } 
        }
        cout << res << endl;
    }
    else{
        cout << "YES" << endl;
    }
}

int main()
{
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}